/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ep.persistence.entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Spyros
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@Entity
@Table(name = "t002_doctor", catalog = "epresc", schema = "")
@NamedQueries({
    @NamedQuery(name = "T002Doctor.findAll", query = "SELECT t FROM T002Doctor t"),
    @NamedQuery(name = "T002Doctor.findById", query = "SELECT t FROM T002Doctor t WHERE t.id = :id"),
    @NamedQuery(name = "T002Doctor.findByFirstName", query = "SELECT t FROM T002Doctor t WHERE t.firstName = :firstName"),
    @NamedQuery(name = "T002Doctor.findBySurname", query = "SELECT t FROM T002Doctor t WHERE t.surname = :surname"),
    @NamedQuery(name = "T002Doctor.findByFatherName", query = "SELECT t FROM T002Doctor t WHERE t.fatherName = :fatherName"),
    @NamedQuery(name = "T002Doctor.findByMotherName", query = "SELECT t FROM T002Doctor t WHERE t.motherName = :motherName"),
    @NamedQuery(name = "T002Doctor.findByDateOfBirth", query = "SELECT t FROM T002Doctor t WHERE t.dateOfBirth = :dateOfBirth"),
    @NamedQuery(name = "T002Doctor.findByAmka", query = "SELECT t FROM T002Doctor t WHERE t.amka = :amka"),
    @NamedQuery(name = "T002Doctor.findByAmetaa", query = "SELECT t FROM T002Doctor t WHERE t.ametaa = :ametaa"),
    @NamedQuery(name = "T002Doctor.findByDateAmetaa", query = "SELECT t FROM T002Doctor t WHERE t.dateAmetaa = :dateAmetaa"),
    @NamedQuery(name = "T002Doctor.findByAfm", query = "SELECT t FROM T002Doctor t WHERE t.afm = :afm"),
    @NamedQuery(name = "T002Doctor.findBySpecialty", query = "SELECT t FROM T002Doctor t WHERE t.specialty = :specialty"),
    @NamedQuery(name = "T002Doctor.findByDocClub", query = "SELECT t FROM T002Doctor t WHERE t.docClub = :docClub"),
    @NamedQuery(name = "T002Doctor.findByLicenceNo", query = "SELECT t FROM T002Doctor t WHERE t.licenceNo = :licenceNo"),
    @NamedQuery(name = "T002Doctor.findByPhone", query = "SELECT t FROM T002Doctor t WHERE t.phone = :phone"),
    @NamedQuery(name = "T002Doctor.findByMob", query = "SELECT t FROM T002Doctor t WHERE t.mob = :mob"),
    @NamedQuery(name = "T002Doctor.findByEmail", query = "SELECT t FROM T002Doctor t WHERE t.email = :email"),
    @NamedQuery(name = "T002Doctor.findByAddress", query = "SELECT t FROM T002Doctor t WHERE t.address = :address"),
    @NamedQuery(name = "T002Doctor.findByTk", query = "SELECT t FROM T002Doctor t WHERE t.tk = :tk"),
    @NamedQuery(name = "T002Doctor.findByCity", query = "SELECT t FROM T002Doctor t WHERE t.city = :city")})
public class T002Doctor implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "first_name")
    private String firstName;
    @Basic(optional = false)
    @Column(name = "surname")
    private String surname;
    @Column(name = "father_name")
    private String fatherName;
    @Column(name = "mother_name")
    private String motherName;
    @Column(name = "dateOfBirth")
    @Temporal(TemporalType.DATE)
    private Date dateOfBirth;
    @Basic(optional = false)
    @Column(name = "amka")
    private String amka;
    @Basic(optional = false)
    @Column(name = "ametaa")
    private String ametaa;
    @Column(name = "date_ametaa")
    @Temporal(TemporalType.DATE)
    private Date dateAmetaa;
    @Column(name = "afm")
    private String afm;
    @Column(name = "specialty")
    private String specialty;
    @Column(name = "doc_club")
    private String docClub;
    @Basic(optional = false)
    @Column(name = "licence_no")
    private String licenceNo;
    @Column(name = "phone")
    private String phone;
    @Column(name = "mob")
    private String mob;
    @Column(name = "email")
    private String email;
    @Column(name = "address")
    private String address;
    @Column(name = "tk")
    private String tk;
    @Column(name = "city")
    private String city;
    @JoinColumn(name = "t001_user_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private T001User t001User;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "t002Doctor")
//    private Collection<T006Prescription> t006PrescriptionCollection;
    @ManyToMany(mappedBy = "t002Doctors")
    private Collection<T004Insurance> t004Insurances;

    public T002Doctor() {
    }

    public T002Doctor(Integer id) {
        this.id = id;
    }

    public T002Doctor(Integer id, String firstName, String surname, String amka, String ametaa, String licenceNo) {
        this.id = id;
        this.firstName = firstName;
        this.surname = surname;
        this.amka = amka;
        this.ametaa = ametaa;
        this.licenceNo = licenceNo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getFatherName() {
        return fatherName;
    }

    public void setFatherName(String fatherName) {
        this.fatherName = fatherName;
    }

    public String getMotherName() {
        return motherName;
    }

    public void setMotherName(String motherName) {
        this.motherName = motherName;
    }

    public Date getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(Date dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public String getAmka() {
        return amka;
    }

    public void setAmka(String amka) {
        this.amka = amka;
    }

    public String getAmetaa() {
        return ametaa;
    }

    public void setAmetaa(String ametaa) {
        this.ametaa = ametaa;
    }

    public Date getDateAmetaa() {
        return dateAmetaa;
    }

    public void setDateAmetaa(Date dateAmetaa) {
        this.dateAmetaa = dateAmetaa;
    }

    public String getAfm() {
        return afm;
    }

    public void setAfm(String afm) {
        this.afm = afm;
    }

    public String getSpecialty() {
        return specialty;
    }

    public void setSpecialty(String specialty) {
        this.specialty = specialty;
    }

    public String getDocClub() {
        return docClub;
    }

    public void setDocClub(String docClub) {
        this.docClub = docClub;
    }

    public String getLicenceNo() {
        return licenceNo;
    }

    public void setLicenceNo(String licenceNo) {
        this.licenceNo = licenceNo;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getMob() {
        return mob;
    }

    public void setMob(String mob) {
        this.mob = mob;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTk() {
        return tk;
    }

    public void setTk(String tk) {
        this.tk = tk;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @XmlTransient
    public T001User getT001User() {
        return t001User;
    }

    public void setT001User(T001User t001User) {
        this.t001User = t001User;
    }

//    @XmlTransient
//    public Collection<T006Prescription> getT006PrescriptionCollection() {
//        return t006PrescriptionCollection;
//    }
//
//    public void setT006PrescriptionCollection(Collection<T006Prescription> t006PrescriptionCollection) {
//        this.t006PrescriptionCollection = t006PrescriptionCollection;
//    }

    
    public Collection<T004Insurance> getT004Insurances() {
        return t004Insurances;
    }

    public void setT004Insurances(Collection<T004Insurance> t004Insurances) {
        this.t004Insurances = t004Insurances;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof T002Doctor)) {
            return false;
        }
        T002Doctor other = (T002Doctor) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return firstName + " " + surname;
    }
}
